import pandas as pd
import plotly.express as px
import numpy as np
# Takes quite a bit of time for date-inference
# Optimization: Consider manual caching in a dict (top StOvflw answer)
data = pd.read_csv("PecanStreet_Project/dataport-export_gas_oct2015-mar2016.csv")
How many houses are included in the measurement study? Are there any malfunctioning meters? If so, identify them and the time periods where they were malfunctioning. The information below regarding data collection may be useful.
print("Number of unique houses: ", len(data["dataid"].unique()))
Number of unique houses: 157
# Calculating Time Difference in Seconds
# Caclulating Difference between readings (in order)
# Assumption: localminute column is clean and error free
merged_df = pd.DataFrame()
for k,df in data.groupby(["dataid"]):
df.sort_values(by=["localminute"], inplace=True)
df["val_diff"] = df["meter_value"].diff()
df["time_diff"] = pd.to_datetime(df['localminute'], utc=True, infer_datetime_format=True, cache=True).diff().astype('timedelta64[s]')
merged_df = merged_df.append(df)
Generate hourly readings from the raw data. Select one month from the 6-month study interval and plot the hourly readings (time-series) for that month. Hint: You will have to decide what to do if there are no readings for a certain hour.
# How many readings do I have per house?
keys, counts = zip(*[(k, len(df)) for k, df in merged_df.groupby("dataid")])
px.scatter(x=keys, y=counts, log_y=True, color=counts, title="Number of Readings per House").show()
# looks like some houses don't have a lot of readings.
# Let's extract the house_ids
MIN_NUM_READING_THRESHOLD = 50
less_readings = [(x, y) for x, y in list(zip(keys, counts)) if y < MIN_NUM_READING_THRESHOLD]
less_readings
[(2814, 37), (2946, 45), (4671, 21), (4874, 2), (5545, 33), (6101, 3), (7566, 32), (9620, 23)]
# Q: get rid of these houses in less_readings before next cells?
keys, means, stds, maxs, mins = zip(*[(k, df["val_diff"].mean(), df["val_diff"].std(), df["val_diff"].max(), df["val_diff"].min()) for k, df in merged_df.groupby("dataid")])
px.scatter(x=keys, y=means, log_y=True, title="Mean Meter Diff per House").show()
px.scatter(x=keys, y=maxs, log_y=True, title="Max Meter Diff per House").show()
px.scatter(x=keys, y=mins, title="Min Meter Diff per House").show()
# Interesting. Some houses haev negative diff. Malfunctioning meters?
# How many bad readings and how many houses?
negative_diff_df = merged_df[merged_df['val_diff'] < 0]
print(len(negative_diff_df)) # how many readings
print(negative_diff_df['dataid'].nunique()) # how many houses
print(negative_diff_df['dataid'].unique()) # which houses
1306 43 [ 35 77 94 483 484 1042 1086 1185 1507 1556 1718 1790 1801 2129 2335 2449 3134 3527 3544 3893 4031 4193 4514 4998 5129 5131 5193 5403 5810 5814 5892 6836 7017 7030 7117 7739 7794 7989 8156 8890 9134 9639 9982]
# When do the spikes happen for each house?
# Note that this diff < 0 signifies represents the RIGHT END of a spike, _NOT_ PEAK.
spike_dict = {} # dataid: number of spikes, first_spike_time, last_spike_time, diff_first_last_in_hours
for k, df in negative_diff_df.groupby('dataid'):
num_spikes = len(df)
first_spike_end = df['localminute'].iloc[0]
last_spike_end = df['localminute'].iloc[-1]
spike_dict[k] = (num_spikes, first_spike_end, last_spike_end, (pd.to_datetime(last_spike_end, utc=True)-pd.to_datetime(first_spike_end, utc=True)))
spike_dict
{35: (1,
'2015-10-20 09:00:12-05',
'2015-10-20 09:00:12-05',
Timedelta('0 days 00:00:00')),
77: (1,
'2015-10-20 20:20:55-05',
'2015-10-20 20:20:55-05',
Timedelta('0 days 00:00:00')),
94: (6,
'2015-11-01 01:11:10-06',
'2016-01-18 11:26:52.211985-06',
Timedelta('78 days 10:15:42.211985')),
483: (1,
'2015-10-21 00:18:54-05',
'2015-10-21 00:18:54-05',
Timedelta('0 days 00:00:00')),
484: (9,
'2015-11-01 01:18:29-06',
'2016-03-05 01:57:57.625975-06',
Timedelta('125 days 00:39:28.625975')),
1042: (1,
'2015-10-07 14:32:08-05',
'2015-10-07 14:32:08-05',
Timedelta('0 days 00:00:00')),
1086: (1,
'2015-11-01 01:32:25-06',
'2015-11-01 01:32:25-06',
Timedelta('0 days 00:00:00')),
1185: (135,
'2015-10-17 10:51:09-05',
'2015-12-13 01:27:54-06',
Timedelta('56 days 15:36:45')),
1507: (2,
'2015-11-01 01:39:26-06',
'2015-11-01 01:57:27-06',
Timedelta('0 days 00:18:01')),
1556: (12,
'2015-10-17 12:01:05-05',
'2015-12-11 02:14:36-06',
Timedelta('54 days 15:13:31')),
1718: (4,
'2015-10-20 16:27:02-05',
'2015-10-20 20:16:07-05',
Timedelta('0 days 03:49:05')),
1790: (1,
'2015-10-20 16:12:26-05',
'2015-10-20 16:12:26-05',
Timedelta('0 days 00:00:00')),
1801: (1,
'2015-10-20 07:52:02-05',
'2015-10-20 07:52:02-05',
Timedelta('0 days 00:00:00')),
2129: (3,
'2015-11-01 01:24:54-06',
'2015-11-01 01:55:52-06',
Timedelta('0 days 00:30:58')),
2335: (5,
'2015-10-20 18:23:32-05',
'2015-12-11 23:52:27-06',
Timedelta('52 days 06:28:55')),
2449: (93,
'2015-10-17 15:44:26-05',
'2015-12-13 01:34:19-06',
Timedelta('56 days 10:49:53')),
3134: (18,
'2015-10-20 13:51:35-05',
'2015-12-12 17:10:28-06',
Timedelta('53 days 04:18:53')),
3527: (1,
'2015-11-01 01:11:57-06',
'2015-11-01 01:11:57-06',
Timedelta('0 days 00:00:00')),
3544: (18,
'2015-12-07 19:49:52-06',
'2015-12-12 18:48:35-06',
Timedelta('4 days 22:58:43')),
3893: (2,
'2015-11-01 01:15:36-06',
'2015-11-01 01:31:36-06',
Timedelta('0 days 00:16:00')),
4031: (16,
'2015-10-08 07:06:58-05',
'2016-03-28 14:22:29.36998-05',
Timedelta('172 days 07:15:31.369980')),
4193: (1,
'2015-11-01 01:23:17-06',
'2015-11-01 01:23:17-06',
Timedelta('0 days 00:00:00')),
4514: (141,
'2015-10-17 09:53:59-05',
'2016-03-30 22:00:32.143429-05',
Timedelta('165 days 12:06:33.143429')),
4998: (1,
'2015-10-20 07:38:11-05',
'2015-10-20 07:38:11-05',
Timedelta('0 days 00:00:00')),
5129: (76,
'2015-10-17 18:39:09-05',
'2015-12-13 02:02:14-06',
Timedelta('56 days 08:23:05')),
5131: (1,
'2016-03-31 00:33:36.630053-05',
'2016-03-31 00:33:36.630053-05',
Timedelta('0 days 00:00:00')),
5193: (4,
'2015-11-01 01:40:25-06',
'2015-11-01 07:48:35-06',
Timedelta('0 days 06:08:10')),
5403: (156,
'2015-10-17 10:18:23-05',
'2016-03-30 22:02:41.698151-05',
Timedelta('165 days 11:44:18.698151')),
5810: (10,
'2015-10-31 00:04:45-05',
'2016-02-22 17:42:13.232644-06',
Timedelta('114 days 18:37:28.232644')),
5814: (1,
'2015-11-01 01:57:39-06',
'2015-11-01 01:57:39-06',
Timedelta('0 days 00:00:00')),
5892: (1,
'2015-11-01 01:22:43-06',
'2015-11-01 01:22:43-06',
Timedelta('0 days 00:00:00')),
6836: (51,
'2015-10-17 12:36:50-05',
'2015-12-12 23:56:47-06',
Timedelta('56 days 12:19:57')),
7017: (1,
'2015-10-20 12:05:00-05',
'2015-10-20 12:05:00-05',
Timedelta('0 days 00:00:00')),
7030: (90,
'2015-10-17 10:25:30-05',
'2015-12-13 01:20:11-06',
Timedelta('56 days 15:54:41')),
7117: (123,
'2015-10-17 00:07:17-05',
'2016-03-30 23:06:13.750732-05',
Timedelta('165 days 22:58:56.750732')),
7739: (1,
'2015-11-01 01:53:25-06',
'2015-11-01 01:53:25-06',
Timedelta('0 days 00:00:00')),
7794: (1,
'2015-11-01 08:01:58-06',
'2015-11-01 08:01:58-06',
Timedelta('0 days 00:00:00')),
7989: (2,
'2015-11-01 01:45:28-06',
'2015-12-13 00:01:18-06',
Timedelta('41 days 22:15:50')),
8156: (151,
'2015-10-17 13:06:23-05',
'2015-12-13 00:53:41-06',
Timedelta('56 days 12:47:18')),
8890: (44,
'2015-10-01 19:07:10-05',
'2016-03-26 15:03:15.534834-05',
Timedelta('176 days 19:56:05.534834')),
9134: (115,
'2015-10-17 13:27:19-05',
'2015-12-13 02:01:12-06',
Timedelta('56 days 13:33:53')),
9639: (2,
'2015-12-22 00:27:07.912441-06',
'2015-12-22 11:54:52-06',
Timedelta('0 days 11:27:44.087559')),
9982: (2,
'2015-12-08 20:31:41-06',
'2015-12-11 12:29:49-06',
Timedelta('2 days 15:58:08'))}
# Looks like it happens throughout the time period we have
# TODO: need to create a list for each house for when do the spikes happen?
px.scatter(negative_diff_df, x='localminute')
keys, means, stds, maxs, mins = zip(*[(k, df["time_diff"].mean(), df["time_diff"].std(), df["time_diff"].max(), df["time_diff"].min()) for k, df in merged_df.groupby("dataid")])
px.scatter(x=keys, y=means, log_y=True, title="Mean Time between readings (s) per House").show()
px.scatter(x=keys, y=mins, title="Minimum Time between readings (s) per House").show()
px.scatter(x=keys, y=maxs, log_y=True, title="Max Time between readings (s) Per House").show()
px.scatter(x=keys, y=stds, log_y=True, title="Standard Deviation of Time between (s) readings by House").show()
# Resampling per hour
resampled_df = pd.DataFrame()
for k, df in merged_df.groupby("dataid"):
df = df.set_index(pd.DatetimeIndex(pd.to_datetime(df['localminute'], utc=True, infer_datetime_format=True, cache=True)))
df.drop(columns=["localminute"], inplace=True)
df.drop(columns=["val_diff", "time_diff"], inplace=True)
# keep last sample of every hour only
# missing hours become NA
sample = df.resample('1h').last()
# fix data_id for missing rows
sample["dataid"].fillna(k, inplace=True)
# TODO configurable hyperparameter for "fixing data"
sample["meter_value"] = sample["meter_value"].interpolate()
resampled_df = resampled_df.append(sample)
resampled_december_data = resampled_df.loc['2015-12-01':'2015-12-31']
px.line(resampled_december_data, x=resampled_december_data.index, y="meter_value", color="dataid").show()
# Question: How do we clkean the negative readings?
# Option 1: Modify merged_df so that diff = 0
# Option 2: Get rid of the rows in merged_df so our fill can path it automatically (OPTION CHOSEN IN CODE BELOW)
spikeless_resampled_df = pd.DataFrame()
for k, df in merged_df.groupby("dataid"):
df = df.set_index(pd.DatetimeIndex(pd.to_datetime(df['localminute'], utc=True, infer_datetime_format=True, cache=True)))
df.drop(columns=["localminute"], inplace=True)
spikeless_df = df[~(df['val_diff'].shift(-1) < 0)]
spikeless_df['val_diff'] = spikeless_df['meter_value'].diff()
# Need to do this because some spikes are less "sharp" than 1 timestemp
for i in range(10): # by right should be doing UNTIL no more spikes left. Tested to see no more spikes after 10 passes
spikeless_df = spikeless_df[~(spikeless_df['val_diff'].shift(-1) < 0)]
spikeless_df['val_diff'] = spikeless_df['meter_value'].diff()
spikeless_df.drop(columns=["val_diff", "time_diff"], inplace=True)
spikeless_sample = spikeless_df.resample('1h').last()
spikeless_sample["dataid"].fillna(k, inplace=True)
spikeless_sample["meter_value"] = spikeless_sample["meter_value"].interpolate()
spikeless_resampled_df = spikeless_resampled_df.append(spikeless_sample)
/home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy /home/julio/.local/lib/python3.6/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
# let's see how spikeless looks now.
spikeless_resampled_december_data = spikeless_resampled_df.loc['2015-12-01':'2015-12-31']
px.line(spikeless_resampled_december_data, x=spikeless_resampled_december_data.index, y="meter_value", color="dataid").show()
px.line(spikeless_resampled_df, x=spikeless_resampled_df.index, y="meter_value", color="dataid").show()